Load packages

require(conflicted)
require(MASS)
require(dplyr)
require(zooper)
require(lubridate)
require(readr)
require(tidyr)
require(ggplot2)
require(sf)
require(readxl)
require(stringr)
require(mgcv)
require(purrr)
require(deltamapr)
require(scales)

conflict_prefer("filter", "dplyr")
conflict_prefer("select", "dplyr")

Load and wrangle data

zoop_data<-Zoopsynther(Data_type="Community", Sources=c("EMP", "STN", "20mm", "FMWT"), Time_consistency = TRUE)
## [1] "These species have no relatives in their size class common to all datasets and have been removed from one or more size classes: Ostracoda Adult (Meso), Cumacea Adult (Meso), Annelida Adult (Meso), Gammarus Adult (Meso), Orientomysis aspera Adult (Meso), Chironomidae Larva (Meso), Insecta Larva (Meso)"

Read in zoop mass conversions

zoop_mass_conversions<-read_excel("Data/SMSCG salinity modeling/Biomass conversions.xlsx", sheet="Micro and Meso-zooplankton")%>%
  mutate(Taxname=case_when(Taxname=="Sinocalanus"~"Sinocalanus doerrii", # Change to help this match to zoop data
                           TRUE ~ Taxname),
         Taxlifestage=paste(Taxname, Lifestage))%>%
  select(Taxlifestage, CarbonWeight_ug)

Read in zoop groupings

zoop_groups<-read_csv("Data/zoopcrosswalk2.csv", col_types=cols_only(Taxlifestage="c", IBMR="c"))%>%
  distinct()

Load Mysid biomass data

zoop_mysid<-read_excel("Data/1972-2020MysidBPUEMatrix.xlsx", # EMP
                       sheet="Mysid_BPUE_matrix_1972-2020", na = "NA",
                       col_types = c(rep("numeric", 4), "date", "text", "text", rep("text", 7), rep("numeric", 8)))%>%
  select(Date=SampleDate, Station=StationNZ, BPUE=`Hyperacanthomysis longirostris`)%>% # Only select Hyperacanthomysis longirostris
  mutate(Source="EMP")%>%
  bind_rows(read_csv("Data/FMWT STN 2007to2019 Mysid BPUE.csv", # FMWT/STN
                     col_types=cols_only(Station="c", SampleDate="c", Project="c", `Hyperacanthomysis longirostris`="d"))%>% 
              rename(Date=SampleDate, Source=Project, BPUE=`Hyperacanthomysis longirostris`)%>% # Only select Hyperacanthomysis longirostris
              mutate(Date=mdy(Date),
                     Station=recode(Station, MONT="Mont", HONK="Honk")))%>% #Get station names to match to main dataset
  mutate(BPUE_mysid=BPUE*1000, # Convert to ug
         Taxlifestage="Hyperacanthomysis longirostris Adult",
         SampleID=paste(Source, Station, Date),
         SizeClass="Macro")%>%
  select(SampleID, Taxlifestage, SizeClass, BPUE_mysid)

Start processing the zoop data

zoop_data_mass<-zoop_data%>%
  mutate(Taxlifestage=str_remove(Taxlifestage, fixed("_UnID")))%>%
  filter(
    !(SizeClass=="Meso" & #eliminating species which are counted in meso and micro and retained better in the micro net from the meso calcs
        
        Taxlifestage%in%c("Asplanchna Adult", "Copepoda Larva","Cyclopoida Juvenile", "Eurytemora Larva", "Harpacticoida Undifferentiated",
                          "Keratella Adult", "Limnoithona Adult", "Limnoithona Juvenile", "Limnoithona sinenesis Adult", "Limnoithona tetraspina
                                    Adult", "Oithona Adult", "Oithona Juvenile", "Oithona davisae Adult", "Polyarthra Adult","Pseudodiaptomus Larva", 
                          "Rotifera Adult", "Sinocalanus doerrii Larva", "Synchaeta Adult", "Synchaeta bicornis Adult", "Trichocerca Adult")) &
      
      !(SizeClass=="Micro" &Taxlifestage%in%c("Cirripedia Larva", "Cyclopoida Adult", "Oithona similis")) & #removing categories better retained in meso net from micro net matrix
      Order!="Amphipoda" & # Remove amphipods
      (Order!="Mysida" | Taxlifestage=="Hyperacanthomysis longirostris Adult"))%>% #Only retain Hyperacanthomysis longirostris
  mutate(Taxlifestage=recode(Taxlifestage, `Synchaeta bicornis Adult`="Synchaeta Adult", # Change some names to match to biomass conversion dataset
                             `Pseudodiaptomus Adult`="Pseudodiaptomus forbesi Adult",
                             `Acanthocyclops vernalis Adult`="Acanthocyclops Adult"))%>%
  left_join(zoop_mass_conversions, by="Taxlifestage")%>% # Add biomass conversions
  left_join(zoop_mysid, by=c("SampleID", "Taxlifestage", "SizeClass"))%>% # Add mysid biomass
  left_join(zoop_groups, by="Taxlifestage")%>% # Add IBMR categories
  mutate(BPUE=if_else(Taxlifestage=="Hyperacanthomysis longirostris Adult", BPUE_mysid, CPUE*CarbonWeight_ug))%>% # Create 1 BPUE variable
  filter(!is.na(BPUE) & !is.na(Latitude) & !is.na(Longitude) & !is.na(SalSurf))%>% # Removes any data without BPUE, which is currently restricted to Decapod Larvae, and H. longirostris from STN. Also removes 20mm and EMP EZ stations without coordinates
  group_by(IBMR)%>%
  mutate(flag=if_else(all(c("Micro", "Meso")%in%SizeClass), "Remove", "Keep"))%>% # This and the next 2 lines are meant to ensure that all categories are consistent across the surveys. Since only EMP samples microzoops, only EMP data can be used for categories that include both micro and mesozoops.
  ungroup()%>%
  filter(!(flag=="Remove" & Source!="EMP"))%>%
  select(SampleID, Station, Latitude, Longitude, SalSurf, Date, Year, IBMR, BPUE)%>%
  group_by(across(-BPUE))%>%
  summarise(BPUE=sum(BPUE), .groups="drop")%>% # Sum each IBMR categories
  st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)%>%
  st_transform(crs=st_crs(deltamapr::R_DSIBM)) %>% 
  st_join(deltamapr::R_DSIBM %>%
            select(SUBREGION)) %>%
  st_drop_geometry() %>% 
  filter(SUBREGION %in% c("NW Suisun","SW Suisun","NE Suisun","SE Suisun","Confluence", "Suisun Marsh"))%>%
  mutate(doy=yday(Date), #Day of year
         Month=month(Date), # Month
         Year_fac=factor(Year), # Factor year for model random effect
         Station_fac=factor(Station), # Factor station for model random effect
         across(c(SalSurf, doy), list(s=~(.x-mean(.x))/sd(.x))), # Center and standardize predictors
         BPUE_log1p=log(BPUE+1)) # log1p transform BPUE for model

Check sample size

zoop_sample_size <- zoop_data_mass %>% 
  group_by(SampleID,Year,Month,SUBREGION,Station) %>% 
  summarise(BPUE=sum(BPUE)) %>% 
  mutate(Samplesize=1) %>%
  group_by(Year, Month, SUBREGION) %>% 
  summarise(mean_BPUE=mean(BPUE),Samplesize=sum(Samplesize)) %>%
  filter(Year>=1995)

ggplot(zoop_sample_size, aes(x=Year, y=Month, fill=Samplesize))+
  geom_tile()+
  scale_y_continuous(breaks=1:12, labels=month(1:12, label=T))+
  scale_fill_viridis_c(breaks=c(1,5,10,15,20))+
  facet_wrap(~SUBREGION)+
  theme_bw()

All the remaining brackish regions have sufficient sample size with the exception of NE Suisun. As such, NE Suisun is to be combined with SE Suisun while the rest of the regions are to be analyzed on their own.

Create a new column with IBMR edited regions to accomodate combination of NE and SE Suisun regions.

zoop_data_mass$Subregion_edit<-ifelse(zoop_data_mass$SUBREGION%in%c("NE Suisun", "SE Suisun"), "East Suisun", zoop_data_mass$SUBREGION)

Model

Prediction data

Set up prediction data for model

# Min year to start models
year_min<-1995

newdata_function<-function(region, data=zoop_data_mass, quant=0.99){
  
  lower<-(1-quant)/(2)
  upper<-1-lower
  
  data_filt<-data%>%
    filter(Subregion_edit%in%region & Year >= year_min)
  
  # Calculate monthly quantiles of salinity
  month_sal<-data_filt%>%
    group_by(Month)%>%
    summarise(l=quantile(SalSurf, lower),
              u=quantile(SalSurf, upper), .groups="drop")
  
  newdata<-expand_grid(date=mdy(paste(1:12, 15, 2001, sep="/")), # The 15th of each month on a non-leap year
                       SalSurf=seq(round(min(data_filt$SalSurf), 1), 
                                   round(max(data_filt$SalSurf), 1), by=0.1))%>% # Salinity sequence nicely rounded to 1 decimal
    mutate(Month=month(date),
           doy=yday(date), # Day of year
           SalSurf_s=(SalSurf-mean(data$SalSurf))/sd(data$SalSurf), # center and standardize salinity to match data
           doy_s=(doy-mean(data$doy))/sd(data$doy))%>% # center and standardize doy to match data
    left_join(month_sal, by="Month")%>%
    filter(SalSurf >= l & SalSurf <= u)%>% # Remove any salinity values outside the quantiles for each month
    select(Month, doy, doy_s, SalSurf, SalSurf_s)
  
}

newdata<-map(set_names(unique(zoop_data_mass$Subregion_edit)), newdata_function)

Posterior prediction function

# Function to generate posterior predictions from a gam model
# From https://stats.stackexchange.com/questions/190348/can-i-use-bootstrapping-to-estimate-the-uncertainty-in-a-maximum-value-of-a-gam
predict_posterior<-function(model, newdata, exclude, n=1e3, seed=999){
  Xp <- predict(model, newdata=newdata, type="lpmatrix", exclude=exclude, newdata.guaranteed=TRUE) ## map coefs to fitted curves
  beta <- coef(model)
  Vb   <- vcov(model) ## posterior mean and cov of coefs
  set.seed(seed)
  mrand <- mvrnorm(n, beta, Vb) ## simulate n rep coef vectors from posterior
  pred<-matrix(nrow=nrow(newdata), ncol=n)
  ilink <- family(model)$linkinv
  for (i in seq_len(n)) { 
    pred[,i]   <- ilink(Xp %*% mrand[i, ])
  }
  colnames(pred)<-paste("draw", 1:n, sep="_")
  pred<-as_tibble(pred)
  return(pred)
}

Model fitting

model

sal_model<-function(group,region,new_data=newdata){
  
  cat("<<<<<<<<<<<<<<<<<<<<<<< modeling", group, region, ">>>>>>>>>>>>>>>>>>>>>>>>>\n\n")
  
  new_data<-new_data[[region]]
  
  data<-filter(zoop_data_mass, IBMR==group & Subregion_edit==region & Year>=year_min)
  
  par(mfrow=c(2,2))
  
  if(length(unique(data$Station_fac))>1){
    model<-gam(BPUE_log1p ~ te(SalSurf_s, doy_s, k=c(5,5), bs=c("cs", "cc")) + 
                 s(Year_fac, bs="re") + s(Station_fac, bs="re"),
               data=data, 
               method="REML")
    
    random_effects<-c("s(Year_fac)", "s(Station_fac)")
    
  }else{
    
    model<-gam(BPUE_log1p ~ te(SalSurf_s, doy_s, k=c(5,5), bs=c("cs", "cc")) + 
                 s(Year_fac, bs="re"),
               data=data, 
               method="REML")
    
    random_effects<-c("s(Year_fac)")
  }
  
  cat("-------------gam check-------------\n")
  gam.check(model)
  
  cat("\n\n-------------summary-------------\n")
  print(summary(model))
  
  sal<-predict_posterior(model, new_data, random_effects)%>%
    bind_cols(new_data%>% # Add covariate columns before these columns
                select(-doy_s, -SalSurf_s), 
              .)
  return(sal)
}

Apply model to all groups and regions

model_factors<-expand_grid(IBMR=unique(zoop_data_mass$IBMR),
                           Subregion_edit=unique(zoop_data_mass$Subregion_edit))%>%
  mutate(IBMR=set_names(IBMR, paste(IBMR, Subregion_edit)))

sal_conversions<-pmap_dfr(model_factors, function(IBMR, Subregion_edit) sal_model(IBMR, Subregion_edit), .id = "IBMR_region")%>%
  mutate(IBMR=sapply(IBMR_region, function(x) str_split(x, " ", n=2)[[1]][1]),
         Region=factor(sapply(IBMR_region, function(x) str_split(x, " ", n=2)[[1]][2]),
                       levels=c("Confluence", "Suisun Marsh", "East Suisun", 
                                "NW Suisun", "SW Suisun")),
         Month=as.integer(Month))%>%
  select(-IBMR_region, -doy)%>%
  relocate(Region, Month, IBMR, SalSurf)
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 12 iterations.
## Gradient range [-0.0000001893865,0.0000001046584]
## (score 1648.549 & scale 2.551529).
## Hessian positive definite, eigenvalue range [0.8000125,421.8733].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 11.57    0.99    0.32
## s(Year_fac)         27.00 23.13      NA      NA
## s(Station_fac)       5.00  3.64      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.8260     0.7375   3.832 0.000137 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 11.573     19 821.87 < 0.0000000000000002 ***
## s(Year_fac)         23.132     26  10.39 < 0.0000000000000002 ***
## s(Station_fac)       3.641      4  12.92          0.000000606 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.497   Deviance explained =   52%
## -REML = 1648.5  Scale est. = 2.5515    n = 844
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.000006577054,0.000002917048]
## (score 1960.356 & scale 2.259893).
## Hessian positive definite, eigenvalue range [1.202923,515.3716].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 15.94    0.95    0.02 *
## s(Year_fac)         27.00 24.76      NA      NA  
## s(Station_fac)       5.00  3.32      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)   3.0033     0.3668   8.189 0.000000000000000813 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.94     19 179.02 <0.0000000000000002 ***
## s(Year_fac)         24.76     26  22.43 <0.0000000000000002 ***
## s(Station_fac)       3.32      4  20.03 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.639   Deviance explained = 65.4%
## -REML = 1960.4  Scale est. = 2.2599    n = 1031
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00003703607,0.00003036114]
## (score 4010.188 & scale 2.342237).
## Hessian positive definite, eigenvalue range [2.817146,1057.206].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.39    0.86 <0.0000000000000002 ***
## s(Year_fac)         27.00 25.52      NA                  NA    
## s(Station_fac)      10.00  7.63      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.1430     0.3518   11.78 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 17.388     19 870.10 <0.0000000000000002 ***
## s(Year_fac)         25.516     26  53.66 <0.0000000000000002 ***
## s(Station_fac)       7.627      9  14.46 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.707   Deviance explained = 71.4%
## -REML = 4010.2  Scale est. = 2.3422    n = 2115
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0006679612,0.0004583773]
## (score 3709.235 & scale 1.878394).
## Hessian positive definite, eigenvalue range [2.589112,1039.703].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0 16.8    0.91 <0.0000000000000002 ***
## s(Year_fac)         27.0 25.2      NA                  NA    
## s(Station_fac)      10.0  7.3      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.0272     0.2351   17.13 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.775     19 3226.95 <0.0000000000000002 ***
## s(Year_fac)         25.248     26   36.85 <0.0000000000000002 ***
## s(Station_fac)       7.301      9   12.34 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.814   Deviance explained = 81.8%
## -REML = 3709.2  Scale est. = 1.8784    n = 2080
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.000005676429,0.00000457835]
## (score 2999.928 & scale 1.763481).
## Hessian positive definite, eigenvalue range [1.925905,853.739].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 16.93    0.94   0.005 **
## s(Year_fac)         27.00 25.20      NA      NA   
## s(Station_fac)       8.00  5.36      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.5393     0.2269    15.6 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F             p-value    
## te(SalSurf_s,doy_s) 16.926     19 1531.672 <0.0000000000000002 ***
## s(Year_fac)         25.199     26   30.088 <0.0000000000000002 ***
## s(Station_fac)       5.358      7    8.568 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.797   Deviance explained = 80.3%
## -REML = 2999.9  Scale est. = 1.7635    n = 1708
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0001001109,0.00006445278]
## (score 1208.568 & scale 1.461434).
## Hessian positive definite, eigenvalue range [0.00005142813,364.751].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00000 12.83879    0.88 <0.0000000000000002 ***
## s(Year_fac)         27.00000 16.66107      NA                  NA    
## s(Station_fac)       5.00000  0.00117      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  0.85349    0.07746   11.02 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 12.838789     19 69.950 < 0.0000000000000002 ***
## s(Year_fac)         16.661066     26  1.951          0.000000933 ***
## s(Station_fac)       0.001173      4  0.000                0.394    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.572   Deviance explained = 58.9%
## -REML = 1208.6  Scale est. = 1.4614    n = 730
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0003124102,0.0000216249]
## (score 1256.521 & scale 1.584753).
## Hessian positive definite, eigenvalue range [0.4198283,366.8126].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.22    0.91 <0.0000000000000002 ***
## s(Year_fac)         27.00 18.27      NA                  NA    
## s(Station_fac)       3.00  1.33      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.4095     0.1191   11.84 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 15.217     19 134.252 <0.0000000000000002 ***
## s(Year_fac)         18.275     26   2.383 <0.0000000000000002 ***
## s(Station_fac)       1.335      2   1.958              0.0572 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.684   Deviance explained = 69.9%
## -REML = 1256.5  Scale est. = 1.5848    n = 734
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000004361445,0.000002470225]
## (score 2752.772 & scale 1.827422).
## Hessian positive definite, eigenvalue range [0.6951158,779.229].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.76    0.86 <0.0000000000000002 ***
## s(Year_fac)         27.00 23.57      NA                  NA    
## s(Station_fac)       8.00  2.93      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.8923     0.1272   14.88 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.756     19 495.454 <0.0000000000000002 ***
## s(Year_fac)         23.570     26   9.697 <0.0000000000000002 ***
## s(Station_fac)       2.926      7   0.858              0.0646 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.678   Deviance explained = 68.7%
## -REML = 2752.8  Scale est. = 1.8274    n = 1559
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.002354924,0.01221993]
## (score 3178.883 & scale 2.562011).
## Hessian positive definite, eigenvalue range [0.006762034,822.6947].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000 15.630    0.87 <0.0000000000000002 ***
## s(Year_fac)         27.000 23.468      NA                  NA    
## s(Station_fac)      10.000  0.236      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.4087     0.1353    17.8 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 15.6304     19 307.590 <0.0000000000000002 ***
## s(Year_fac)         23.4682     26  10.296 <0.0000000000000002 ***
## s(Station_fac)       0.2358      9   0.027               0.399    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.572   Deviance explained = 58.2%
## -REML = 3178.9  Scale est. = 2.562     n = 1646
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.000008894614,0.000005076387]
## (score 2408.63 & scale 2.245173).
## Hessian positive definite, eigenvalue range [1.033501,646.2134].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 12.98    0.94 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.10      NA                  NA    
## s(Station_fac)       6.00  3.97      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value          Pr(>|t|)    
## (Intercept)   1.3285     0.1769   7.509 0.000000000000113 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 12.98     19 61.556 < 0.0000000000000002 ***
## s(Year_fac)         21.10     26  4.468 < 0.0000000000000002 ***
## s(Station_fac)       3.97      5  6.081            0.0000035 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.463   Deviance explained = 47.9%
## -REML = 2408.6  Scale est. = 2.2452    n = 1293
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0007049716,0.0005200557]
## (score 1458.787 & scale 2.748531).
## Hessian positive definite, eigenvalue range [1.337259,369.1539].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 12.74    0.98    0.22
## s(Year_fac)         27.00 11.25      NA      NA
## s(Station_fac)       5.00  3.57      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value   Pr(>|t|)    
## (Intercept)   3.1345     0.6754   4.641 0.00000413 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F              p-value    
## te(SalSurf_s,doy_s) 12.739     19 1486.159 < 0.0000000000000002 ***
## s(Year_fac)         11.254     26    0.792              0.00896 ** 
## s(Station_fac)       3.573      4    8.186           0.00000136 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.633   Deviance explained = 64.6%
## -REML = 1458.8  Scale est. = 2.7485    n = 739
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.001070905,0.0008738872]
## (score 1529.328 & scale 2.639282).
## Hessian positive definite, eigenvalue range [0.06028248,388.3144].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 15.710    0.97    0.19
## s(Year_fac)         27.000 18.891      NA      NA
## s(Station_fac)       4.000  0.493      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.5979     0.1231   21.11 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.7097     19 84.461 <0.0000000000000002 ***
## s(Year_fac)         18.8907     26  2.696 <0.0000000000000002 ***
## s(Station_fac)       0.4927      3  0.218               0.268    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.598   Deviance explained = 61.6%
## -REML = 1529.3  Scale est. = 2.6393    n = 777
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.000001429611,0.00000003249666]
## (score 3088.542 & scale 2.498972).
## Hessian positive definite, eigenvalue range [1.184303,803.6996].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.46    0.79 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.37      NA                  NA    
## s(Station_fac)       8.00  5.21      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.9254     0.1411   20.73 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 17.462     19 257.528 < 0.0000000000000002 ***
## s(Year_fac)         21.373     26   4.162 < 0.0000000000000002 ***
## s(Station_fac)       5.206      7   3.329             0.000195 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.631   Deviance explained = 64.1%
## -REML = 3088.5  Scale est. = 2.499     n = 1608
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 12 iterations.
## Gradient range [-0.0000314416,0.00002883043]
## (score 3211.96 & scale 2.644034).
## Hessian positive definite, eigenvalue range [1.504962,823.1962].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.95    0.74 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.71      NA                  NA    
## s(Station_fac)      10.00  4.98      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.9864     0.1313   22.75 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 16.95     19 195.351 < 0.0000000000000002 ***
## s(Year_fac)         21.71     26   5.436 < 0.0000000000000002 ***
## s(Station_fac)       4.98      9   2.267             0.000349 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.615   Deviance explained = 62.5%
## -REML =   3212  Scale est. = 2.644     n = 1647
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0003350443,0.0002726983]
## (score 2813.07 & scale 2.741279).
## Hessian positive definite, eigenvalue range [1.229002,714.7294].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.04    0.76 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.91      NA                  NA    
## s(Station_fac)       8.00  4.47      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.1578     0.1974   21.06 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.037     19 202.677 <0.0000000000000002 ***
## s(Year_fac)         22.913     26   6.577 <0.0000000000000002 ***
## s(Station_fac)       4.474      7   8.104 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.647   Deviance explained = 65.8%
## -REML = 2813.1  Scale est. = 2.7413    n = 1430
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0007416999,0.00005038202]
## (score 1653.883 & scale 2.559664).
## Hessian positive definite, eigenvalue range [1.242421,427.2633].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 11.40       1    0.41
## s(Year_fac)         27.00 19.22      NA      NA
## s(Station_fac)       5.00  2.86      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.6466     0.3377   19.68 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 11.401     19 100.352 <0.0000000000000002 ***
## s(Year_fac)         19.221     26   3.431 <0.0000000000000002 ***
## s(Station_fac)       2.857      4  27.281 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.386   Deviance explained = 41.1%
## -REML = 1653.9  Scale est. = 2.5597    n = 855
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.001038173,0.0008311656]
## (score 1827.875 & scale 1.831343).
## Hessian positive definite, eigenvalue range [0.736008,520.5772].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 15.00    0.95   0.025 *
## s(Year_fac)         27.00  6.16      NA      NA  
## s(Station_fac)       5.00  2.72      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.1337     0.1717   35.73 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.003     19 60.643 <0.0000000000000002 ***
## s(Year_fac)          6.163     26  0.318               0.125    
## s(Station_fac)       2.720      4 11.818 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.417   Deviance explained = 43.1%
## -REML = 1827.9  Scale est. = 1.8313    n = 1042
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00002579016,0.000006583897]
## (score 3687.371 & scale 2.076338).
## Hessian positive definite, eigenvalue range [1.894969,1017.642].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.63    0.91 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.08      NA                  NA    
## s(Station_fac)      10.00  5.87      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.5027     0.1252   43.96 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 13.627     19 85.258 <0.0000000000000002 ***
## s(Year_fac)         21.081     26  4.337 <0.0000000000000002 ***
## s(Station_fac)       5.873      9  6.284 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.303   Deviance explained = 31.7%
## -REML = 3687.4  Scale est. = 2.0763    n = 2036
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.001984523,0.001692732]
## (score 3615.176 & scale 2.561037).
## Hessian positive definite, eigenvalue range [2.353224,933.2142].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.19    0.88 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.56      NA                  NA    
## s(Station_fac)      10.00  6.97      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.7759     0.2237   21.35 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.188     19 461.945 <0.0000000000000002 ***
## s(Year_fac)         24.558     26  16.746 <0.0000000000000002 ***
## s(Station_fac)       6.972      9   8.835 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.552   Deviance explained = 56.4%
## -REML = 3615.2  Scale est. = 2.561     n = 1867
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 11 iterations.
## Gradient range [-0.002103959,0.001942017]
## (score 3102.295 & scale 2.34455).
## Hessian positive definite, eigenvalue range [2.12235,820.7098].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.67    0.93 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.33      NA                  NA    
## s(Station_fac)       8.00  5.94      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.6610     0.2296   24.66 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.667     19 365.313 <0.0000000000000002 ***
## s(Year_fac)         22.331     26   6.875 <0.0000000000000002 ***
## s(Station_fac)       5.944      7  14.078 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.492   Deviance explained = 50.6%
## -REML = 3102.3  Scale est. = 2.3445    n = 1642
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00003002771,0.00002698134]
## (score 1347.676 & scale 1.182251).
## Hessian positive definite, eigenvalue range [1.033518,435.6758].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 12.88    1.03    0.79
## s(Year_fac)         27.00 14.48      NA      NA
## s(Station_fac)       5.00  3.39      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   7.0229     0.3565    19.7 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F   p-value    
## te(SalSurf_s,doy_s) 12.881     19 44.567   0.00172 ** 
## s(Year_fac)         14.475     26  1.204   0.00101 ** 
## s(Station_fac)       3.394      4  6.872 0.0000186 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.336   Deviance explained =   36%
## -REML = 1347.7  Scale est. = 1.1823    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.00002204541,0.00001666173]
## (score 1546.635 & scale 0.9996195).
## Hessian positive definite, eigenvalue range [0.1446414,526.2809].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value  
## te(SalSurf_s,doy_s) 19.000 15.201    0.95   0.015 *
## s(Year_fac)         27.000 21.606      NA      NA  
## s(Station_fac)       5.000  0.928      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  6.49101    0.08527   76.13 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.2014     19 68.636 <0.0000000000000002 ***
## s(Year_fac)         21.6059     26  4.697 <0.0000000000000002 ***
## s(Station_fac)       0.9284      4  0.384               0.195    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.402   Deviance explained = 42.4%
## -REML = 1546.6  Scale est. = 0.99962   n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.0007353555,0.0002111834]
## (score 3113.504 & scale 1.009186).
## Hessian positive definite, eigenvalue range [2.184889,1067.651].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.86    0.82 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.08      NA                  NA    
## s(Station_fac)      10.00  7.07      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.6135     0.1213   54.53 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.86     19 247.727 <0.0000000000000002 ***
## s(Year_fac)         21.08     26   5.007 <0.0000000000000002 ***
## s(Station_fac)       7.07      9   8.499 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.457   Deviance explained = 46.8%
## -REML = 3113.5  Scale est. = 1.0092    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 13 iterations.
## Gradient range [-0.00002334144,0.000002622975]
## (score 2856.866 & scale 0.8144793).
## Hessian positive definite, eigenvalue range [2.782338,1054.664].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.77    0.77 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.18      NA                  NA    
## s(Station_fac)      10.00  7.26      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.7914     0.1025   66.24 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.771     19 842.088 <0.0000000000000002 ***
## s(Year_fac)         22.185     26   6.579 <0.0000000000000002 ***
## s(Station_fac)       7.255      9  14.314 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.662   Deviance explained = 66.9%
## -REML = 2856.9  Scale est. = 0.81448   n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.001746193,0.001381503]
## (score 2504.624 & scale 0.9664801).
## Hessian positive definite, eigenvalue range [2.16893,868.1696].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0 16.7     0.9 <0.0000000000000002 ***
## s(Year_fac)         27.0 19.9      NA                  NA    
## s(Station_fac)       8.0  6.6      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.7287     0.1997    33.7 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.709     19 198.963 <0.0000000000000002 ***
## s(Year_fac)         19.881     26   3.529 <0.0000000000000002 ***
## s(Station_fac)       6.597      7  50.529 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.413   Deviance explained = 42.7%
## -REML = 2504.6  Scale est. = 0.96648   n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000008705367,0.000005907735]
## (score 1181.15 & scale 1.244969).
## Hessian positive definite, eigenvalue range [0.2077835,372.8422].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 10.189       1    0.52
## s(Year_fac)         27.000 21.137      NA      NA
## s(Station_fac)       5.000  0.978      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    1.293      0.109   11.87 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 10.1895     19 202.043 <0.0000000000000002 ***
## s(Year_fac)         21.1368     26   4.029 <0.0000000000000002 ***
## s(Station_fac)       0.9781      4   0.486               0.136    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained = 71.6%
## -REML = 1181.1  Scale est. = 1.245     n = 746
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0004317457,0.0002782451]
## (score 1225.934 & scale 1.23228).
## Hessian positive definite, eigenvalue range [0.0004316071,387.3476].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00000 12.33429    0.89 <0.0000000000000002 ***
## s(Year_fac)         27.00000 21.20347      NA                  NA    
## s(Station_fac)       5.00000  0.00142      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  1.69186    0.09834    17.2 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 12.334291     19 298.538 <0.0000000000000002 ***
## s(Year_fac)         21.203470     26   4.282 <0.0000000000000002 ***
## s(Station_fac)       0.001421      4   0.000               0.678    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.76   Deviance explained =   77%
## -REML = 1225.9  Scale est. = 1.2323    n = 775
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.000005516281,0.000004757904]
## (score 2701.618 & scale 1.246219).
## Hessian positive definite, eigenvalue range [1.413185,857.7241].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.06    0.85 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.40      NA                  NA    
## s(Station_fac)       9.00  5.11      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    2.235      0.134   16.68 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F              p-value    
## te(SalSurf_s,doy_s) 16.061     19 1497.561 < 0.0000000000000002 ***
## s(Year_fac)         24.404     26   15.419 < 0.0000000000000002 ***
## s(Station_fac)       5.115      8    3.267            0.0000663 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.766   Deviance explained = 77.2%
## -REML = 2701.6  Scale est. = 1.2462    n = 1716
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0005140318,0.00009486559]
## (score 3170.835 & scale 1.410279).
## Hessian positive definite, eigenvalue range [1.53027,972.1918].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.18    0.89 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.33      NA                  NA    
## s(Station_fac)      10.00  7.21      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.1273     0.1639   19.07 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.182     19 1459.28 <0.0000000000000002 ***
## s(Year_fac)         24.327     26   16.05 <0.0000000000000002 ***
## s(Station_fac)       7.213      9   19.11 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.684   Deviance explained = 69.2%
## -REML = 3170.8  Scale est. = 1.4103    n = 1945
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001468536,0.0000006484035]
## (score 2423.487 & scale 1.490508).
## Hessian positive definite, eigenvalue range [1.380582,728.7322].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 12.86    0.97    0.11
## s(Year_fac)         27.00 23.55      NA      NA
## s(Station_fac)       8.00  5.33      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.7017     0.1933   8.802 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 12.864     19 396.18 <0.0000000000000002 ***
## s(Year_fac)         23.553     26  10.34 <0.0000000000000002 ***
## s(Station_fac)       5.334      7  19.02 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.553   Deviance explained = 56.6%
## -REML = 2423.5  Scale est. = 1.4905    n = 1458
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.001468335,0.00130738]
## (score 1591.175 & scale 2.268222).
## Hessian positive definite, eigenvalue range [0.7085017,420.8405].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 13.02    0.98    0.22
## s(Year_fac)         27.00 21.52      NA      NA
## s(Station_fac)       5.00  3.14      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value           Pr(>|t|)    
## (Intercept)   3.2489     0.4068   7.987 0.0000000000000048 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.020     19 772.256 <0.0000000000000002 ***
## s(Year_fac)         21.515     26   4.413 <0.0000000000000002 ***
## s(Station_fac)       3.143      4   3.283              0.0139 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.612   Deviance explained = 62.9%
## -REML = 1591.2  Scale est. = 2.2682    n = 842
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0005166779,0.0004110887]
## (score 1831.367 & scale 1.96025).
## Hessian positive definite, eigenvalue range [0.0001786789,507.7936].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value  
## te(SalSurf_s,doy_s) 19.000000 10.662654    0.94   0.025 *
## s(Year_fac)         27.000000 22.545327      NA      NA  
## s(Station_fac)       5.000000  0.000402      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.4691     0.1292   26.86 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 10.662654     19 191.352 <0.0000000000000002 ***
## s(Year_fac)         22.545327     26   5.744 <0.0000000000000002 ***
## s(Station_fac)       0.000402      4   0.000               0.936    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.641   Deviance explained = 65.3%
## -REML = 1831.4  Scale est. = 1.9602    n = 1016
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.00148126,0.001442375]
## (score 3878.283 & scale 2.177848).
## Hessian positive definite, eigenvalue range [1.630563,1052.671].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.84    0.79 <0.0000000000000002 ***
## s(Year_fac)         27.00 23.63      NA                  NA    
## s(Station_fac)      10.00  6.67      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.3298     0.1759   24.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.845     19 905.573 <0.0000000000000002 ***
## s(Year_fac)         23.625     26  10.175 <0.0000000000000002 ***
## s(Station_fac)       6.666      9   9.135 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.681   Deviance explained = 68.7%
## -REML = 3878.3  Scale est. = 2.1778    n = 2106
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 12 iterations.
## Gradient range [-0.00001593149,0.00001504367]
## (score 3902.761 & scale 2.222024).
## Hessian positive definite, eigenvalue range [1.624398,1053.169].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.06     0.7 <0.0000000000000002 ***
## s(Year_fac)         27.00 23.64      NA                  NA    
## s(Station_fac)      10.00  6.51      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    5.976      0.153   39.05 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.06     19 521.726 <0.0000000000000002 ***
## s(Year_fac)         23.64     26  10.286 <0.0000000000000002 ***
## s(Station_fac)       6.51      9   6.915 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.706   Deviance explained = 71.2%
## -REML = 3902.8  Scale est. = 2.222     n = 2107
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.004182847,0.003469361]
## (score 3130.111 & scale 1.962958).
## Hessian positive definite, eigenvalue range [1.306199,865.7348].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.31    0.89 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.77      NA                  NA    
## s(Station_fac)       8.00  6.27      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    5.278      0.263   20.07 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.310     19 2123.91 <0.0000000000000002 ***
## s(Year_fac)         24.771     26   18.37 <0.0000000000000002 ***
## s(Station_fac)       6.274      7   26.35 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.704   Deviance explained = 71.2%
## -REML = 3130.1  Scale est. = 1.963     n = 1732
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000154612,0.00007258112]
## (score 601.3534 & scale 2.330002).
## Hessian positive definite, eigenvalue range [0.0001545943,158.25].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value
## te(SalSurf_s,doy_s) 19.000000  7.843525    1.19       1
## s(Year_fac)         27.000000 11.179917      NA      NA
## s(Station_fac)       3.000000  0.000455      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.1026     0.1156   9.541 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  7.8435253     19 10.457 < 0.0000000000000002 ***
## s(Year_fac)         11.1799165     26  0.784              0.00904 ** 
## s(Station_fac)       0.0004546      2  0.000              0.69048    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.372   Deviance explained =   41%
## -REML = 601.35  Scale est. = 2.33      n = 317
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0000001619108,0.000000007356861]
## (score 617.8933 & scale 2.599724).
## Hessian positive definite, eigenvalue range [1.238011,155.1693].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  9.56    0.99    0.42
## s(Year_fac)         27.00 18.80      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.4834     0.1786   8.307 0.00000000000000423 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s)  9.562     19 13.277 <0.0000000000000002 ***
## s(Year_fac)         18.797     26  2.567 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.443   Deviance explained = 49.4%
## -REML = 617.89  Scale est. = 2.5997    n = 310
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0003086585,0.0002553844]
## (score 1262.904 & scale 2.221373).
## Hessian positive definite, eigenvalue range [0.4256681,334.4252].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 12.91    0.91 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.63      NA                  NA    
## s(Station_fac)       4.00  1.84      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)   1.7264     0.2072   8.334 0.000000000000000489 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 12.909     19 49.826 <0.0000000000000002 ***
## s(Year_fac)         21.634     26  5.032 <0.0000000000000002 ***
## s(Station_fac)       1.841      3  2.151              0.0305 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.536   Deviance explained = 56.1%
## -REML = 1262.9  Scale est. = 2.2214    n = 669
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0004303728,0.00045683]
## (score 1345.29 & scale 2.474344).
## Hessian positive definite, eigenvalue range [0.1057984,347.3914].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000 12.154    0.89    0.01 **
## s(Year_fac)         27.000 21.371      NA      NA   
## s(Station_fac)       5.000  0.522      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.7959     0.1531   11.73 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 12.1538     19 29.248 <0.0000000000000002 ***
## s(Year_fac)         21.3712     26  4.793 <0.0000000000000002 ***
## s(Station_fac)       0.5224      4  0.207               0.197    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.468   Deviance explained = 49.4%
## -REML = 1345.3  Scale est. = 2.4743    n = 695
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0002834877,0.0000007071801]
## (score 1324.81 & scale 3.654516).
## Hessian positive definite, eigenvalue range [0.0002833269,310.4633].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000000  9.462557    0.89 <0.0000000000000002 ***
## s(Year_fac)         27.000000 22.659249      NA                  NA    
## s(Station_fac)       2.000000  0.000568      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value           Pr(>|t|)    
## (Intercept)   1.7120     0.2207   7.758 0.0000000000000383 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s)  9.4625568     19 17.208 <0.0000000000000002 ***
## s(Year_fac)         22.6592491     26  6.757 <0.0000000000000002 ***
## s(Station_fac)       0.0005679      1  0.000               0.967    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.399   Deviance explained =   43%
## -REML = 1324.8  Scale est. = 3.6545    n = 621
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.00005651404,0.00005859625]
## (score 681.6302 & scale 3.422221).
## Hessian positive definite, eigenvalue range [0.00004508318,161.4539].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000000  9.333769    0.88   0.005 **
## s(Year_fac)         27.000000 15.551463      NA      NA   
## s(Station_fac)       3.000000  0.000172      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.6536     0.1665   33.96 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s)  9.3337692     19 7.302 < 0.0000000000000002 ***
## s(Year_fac)         15.5514628     26 1.494             0.000107 ***
## s(Station_fac)       0.0001718      2 0.000             0.583339    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.343   Deviance explained = 39.4%
## -REML = 681.63  Scale est. = 3.4222    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000150143,0.00009574354]
## (score 600.4573 & scale 2.201123).
## Hessian positive definite, eigenvalue range [1.593401,156.5484].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0 11.7    0.98    0.29
## s(Year_fac)         27.0 16.2      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.4074     0.1397   45.85 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s) 11.75     19 46.76 < 0.0000000000000002 ***
## s(Year_fac)         16.17     26  1.67            0.0000324 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained =   73%
## -REML = 600.46  Scale est. = 2.2011    n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.000000239289,0.0000001464564]
## (score 1236.472 & scale 1.965841).
## Hessian positive definite, eigenvalue range [0.8025186,335.9462].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.16    0.85 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.43      NA                  NA    
## s(Station_fac)       4.00  2.32      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    6.765      0.245   27.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 15.158     19 123.851 < 0.0000000000000002 ***
## s(Year_fac)         21.432     26   4.426 < 0.0000000000000002 ***
## s(Station_fac)       2.319      3   5.541             0.000576 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained =   72%
## -REML = 1236.5  Scale est. = 1.9658    n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00004883231,0.000008133469]
## (score 1345.344 & scale 2.325183).
## Hessian positive definite, eigenvalue range [1.009805,350.4133].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 14.78    0.95    0.11
## s(Year_fac)         27.00 21.16      NA      NA
## s(Station_fac)       5.00  2.34      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.4572     0.2244   24.32 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 14.784     19 187.879 < 0.0000000000000002 ***
## s(Year_fac)         21.155     26   4.447 < 0.0000000000000002 ***
## s(Station_fac)       2.337      4   5.369            0.0000308 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.748   Deviance explained = 76.2%
## -REML = 1345.3  Scale est. = 2.3252    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001770403,0.000001619472]
## (score 1260.551 & scale 2.853194).
## Hessian positive definite, eigenvalue range [0.472618,313.8114].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 13.889    0.96    0.15
## s(Year_fac)         27.000 16.907      NA      NA
## s(Station_fac)       2.000  0.973      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.8838     0.4269   13.78 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.8895     19 92.212 < 0.0000000000000002 ***
## s(Year_fac)         16.9071     26  1.801           0.00000818 ***
## s(Station_fac)       0.9731      1 36.476 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.693   Deviance explained = 70.8%
## -REML = 1260.6  Scale est. = 2.8532    n = 628
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0000002316543,0.0000002354506]
## (score 788.2818 & scale 4.303684).
## Hessian positive definite, eigenvalue range [0.009941399,175.6295].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000  9.974    1.02    0.66
## s(Year_fac)         26.000 19.379      NA      NA
## s(Station_fac)       4.000  0.206      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.4872     0.2719    16.5 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s)  9.9737     19 25.475 <0.0000000000000002 ***
## s(Year_fac)         19.3786     25  3.391 <0.0000000000000002 ***
## s(Station_fac)       0.2062      3  0.087               0.283    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.553   Deviance explained = 59.1%
## -REML = 788.28  Scale est. = 4.3037    n = 351
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001090259,0.000001039541]
## (score 892.3173 & scale 3.728494).
## Hessian positive definite, eigenvalue range [0.412642,206.4459].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00  8.49    0.91   0.015 *
## s(Year_fac)         26.00 17.72      NA      NA  
## s(Station_fac)       4.00  2.94      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)    4.582      1.104    4.15 0.0000411 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s)  8.490     19  13.03              0.0032 ** 
## s(Year_fac)         17.721     25   2.67 <0.0000000000000002 ***
## s(Station_fac)       2.943      3 103.25 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.506   Deviance explained = 54.1%
## -REML = 892.32  Scale est. = 3.7285    n = 413
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0007557609,0.0004340541]
## (score 1764.733 & scale 3.552136).
## Hessian positive definite, eigenvalue range [2.033551,414.8406].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.83     0.9 <0.0000000000000002 ***
## s(Year_fac)         26.00 19.48      NA                  NA    
## s(Station_fac)      10.00  8.08      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    5.316      0.483   11.01 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.829     19 66.943 <0.0000000000000002 ***
## s(Year_fac)         19.484     25  4.362 <0.0000000000000002 ***
## s(Station_fac)       8.081      9 15.525 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.536   Deviance explained =   56%
## -REML = 1764.7  Scale est. = 3.5521    n = 830
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0005129698,0.0003546754]
## (score 1640.225 & scale 3.123566).
## Hessian positive definite, eigenvalue range [2.162904,396.8742].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.10    0.92 <0.0000000000000002 ***
## s(Year_fac)         26.00 20.63      NA                  NA    
## s(Station_fac)       9.00  6.14      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.2625     0.3185   13.38 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.103     19 99.083 <0.0000000000000002 ***
## s(Year_fac)         20.632     25  4.998 <0.0000000000000002 ***
## s(Station_fac)       6.138      8  9.453 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.57   Deviance explained = 59.3%
## -REML = 1640.2  Scale est. = 3.1236    n = 794
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0000002627639,0.0000001877132]
## (score 1470.029 & scale 3.254926).
## Hessian positive definite, eigenvalue range [1.808892,349.4785].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 15.14    0.93   0.005 **
## s(Year_fac)         26.00 22.55      NA      NA   
## s(Station_fac)       7.00  5.43      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.3757     0.6341   8.478 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.136     19 71.675 <0.0000000000000002 ***
## s(Year_fac)         22.547     25  8.985 <0.0000000000000002 ***
## s(Station_fac)       5.434      6 16.946 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.493   Deviance explained = 52.4%
## -REML =   1470  Scale est. = 3.2549    n = 699
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0000002064242,0.0000001313375]
## (score 631.4934 & scale 2.689229).
## Hessian positive definite, eigenvalue range [0.3016207,161.1797].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  4.74    1.05    0.68
## s(Year_fac)         27.00 10.04      NA      NA
## s(Station_fac)       3.00  1.35      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   8.2242     0.6539   12.58 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df     F   p-value    
## te(SalSurf_s,doy_s)  4.741     19 2.071 0.0000021 ***
## s(Year_fac)         10.044     26 0.633    0.0285 *  
## s(Station_fac)       1.354      2 2.475    0.0343 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.154   Deviance explained = 19.6%
## -REML = 631.49  Scale est. = 2.6892    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0000003166628,0.00000001099926]
## (score 535.4435 & scale 1.422309).
## Hessian positive definite, eigenvalue range [1.242915,156.7068].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0 12.2    0.96     0.2
## s(Year_fac)         27.0 18.8      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   9.5893     0.1317    72.8 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 12.18     19 31.192 <0.0000000000000002 ***
## s(Year_fac)         18.76     26  2.619 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.601   Deviance explained =   64%
## -REML = 535.44  Scale est. = 1.4223    n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00002785172,0.000004633361]
## (score 915.9835 & scale 0.7496992).
## Hessian positive definite, eigenvalue range [0.561049,335.9529].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 16.17     0.9   0.005 **
## s(Year_fac)         27.00 21.26      NA      NA   
## s(Station_fac)       4.00  1.77      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   9.2526     0.1153   80.28 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 16.168     19 189.288 < 0.0000000000000002 ***
## s(Year_fac)         21.260     26   4.573 < 0.0000000000000002 ***
## s(Station_fac)       1.766      3   3.353              0.00306 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.753   Deviance explained = 76.7%
## -REML = 915.98  Scale est. = 0.7497    n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000000512982,0.0000002724996]
## (score 1278.834 & scale 1.970803).
## Hessian positive definite, eigenvalue range [0.526458,350.3066].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 15.02    0.98    0.35
## s(Year_fac)         27.00 17.46      NA      NA
## s(Station_fac)       5.00  1.63      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   8.2865     0.1381   59.99 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 15.03     19 84.263 < 0.0000000000000002 ***
## s(Year_fac)         17.46     26  1.997           0.00000189 ***
## s(Station_fac)       1.63      4  1.564               0.0166 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.624   Deviance explained = 64.3%
## -REML = 1278.8  Scale est. = 1.9708    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0002389409,0.0001754298]
## (score 998.6822 & scale 1.23984).
## Hessian positive definite, eigenvalue range [0.4798591,313.7857].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 14.16    0.96    0.23
## s(Year_fac)         27.00 15.83      NA      NA
## s(Station_fac)       2.00  0.98      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   9.3379     0.3261   28.64 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 14.1618     19 59.719 < 0.0000000000000002 ***
## s(Year_fac)         15.8272     26  1.537            0.0000547 ***
## s(Station_fac)       0.9804      1 50.302 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.599   Deviance explained = 61.9%
## -REML = 998.68  Scale est. = 1.2398    n = 628
## <<<<<<<<<<<<<<<<<<<<<<< modeling other SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0001181306,0.00003164694]
## (score 657.8992 & scale 3.184574).
## Hessian positive definite, eigenvalue range [0.0001180994,158.5305].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value  
## te(SalSurf_s,doy_s) 19.000000  7.106973    0.89    0.02 *
## s(Year_fac)         27.000000 17.271773      NA      NA  
## s(Station_fac)       3.000000  0.000388      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.8324     0.1769   38.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F    p-value    
## te(SalSurf_s,doy_s)  7.1069729     19 2.572   0.000245 ***
## s(Year_fac)         17.2717731     26 2.036 0.00000223 ***
## s(Station_fac)       0.0003876      2 0.000   0.637914    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.23   Deviance explained = 28.9%
## -REML =  657.9  Scale est. = 3.1846    n = 317
## <<<<<<<<<<<<<<<<<<<<<<< modeling other NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0005107396,0.0001649552]
## (score 681.1145 & scale 4.221794).
## Hessian positive definite, eigenvalue range [0.3661494,154.8462].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  6.33    0.96    0.18
## s(Year_fac)         27.00 13.74      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.0950     0.1717   35.49 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df     F     p-value    
## te(SalSurf_s,doy_s)  6.328     19 3.101 0.000000538 ***
## s(Year_fac)         13.735     26 1.133     0.00125 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.22   Deviance explained =   27%
## -REML = 681.11  Scale est. = 4.2218    n = 310
## <<<<<<<<<<<<<<<<<<<<<<< modeling other East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0009663949,0.0005020085]
## (score 1416.959 & scale 3.606287).
## Hessian positive definite, eigenvalue range [0.3912403,334.3088].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.45    0.84 <0.0000000000000002 ***
## s(Year_fac)         27.00 17.70      NA                  NA    
## s(Station_fac)       4.00  1.53      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.9111     0.1991   29.69 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.455     19 11.270 < 0.0000000000000002 ***
## s(Year_fac)         17.696     26  1.993           0.00000251 ***
## s(Station_fac)       1.529      3  1.954               0.0193 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.277   Deviance explained = 31.2%
## -REML =   1417  Scale est. = 3.6063    n = 669
## <<<<<<<<<<<<<<<<<<<<<<< modeling other Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0005075893,0.0001711053]
## (score 1439.908 & scale 3.172422).
## Hessian positive definite, eigenvalue range [0.0005072981,347.4243].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00000 14.77973     0.9   0.005 **
## s(Year_fac)         27.00000 21.63427      NA      NA   
## s(Station_fac)       5.00000  0.00136      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.5934     0.1717   32.57 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.779732     19 19.038 <0.0000000000000002 ***
## s(Year_fac)         21.634272     26  4.142 <0.0000000000000002 ***
## s(Station_fac)       0.001358      4  0.000               0.789    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.383   Deviance explained = 41.5%
## -REML = 1439.9  Scale est. = 3.1724    n = 695
## <<<<<<<<<<<<<<<<<<<<<<< modeling other Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0005359542,0.0001920192]
## (score 1360.445 & scale 4.14572).
## Hessian positive definite, eigenvalue range [0.0005353824,310.394].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value
## te(SalSurf_s,doy_s) 19.00000 11.31243    0.98    0.26
## s(Year_fac)         27.00000 20.32838      NA      NA
## s(Station_fac)       2.00000  0.00115      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.6270     0.1803   31.21 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 11.312432     19 12.325 <0.0000000000000002 ***
## s(Year_fac)         20.328382     26  3.602 <0.0000000000000002 ***
## s(Station_fac)       0.001147      1  0.000               0.797    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.354   Deviance explained = 38.7%
## -REML = 1360.4  Scale est. = 4.1457    n = 621
sal_conversions
## # A tibble: 88,104 × 1,004
##    Region   Month IBMR  SalSurf draw_1 draw_2 draw_3 draw_4 draw_5 draw_6 draw_7
##    <fct>    <int> <chr>   <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
##  1 SW Suis…     1 acar…     0.1   5.16   3.70   5.69   5.14   3.92   3.87   3.95
##  2 SW Suis…     1 acar…     0.2   5.16   3.71   5.70   5.15   3.95   3.89   3.95
##  3 SW Suis…     1 acar…     0.3   5.15   3.72   5.71   5.15   3.97   3.91   3.95
##  4 SW Suis…     1 acar…     0.4   5.14   3.72   5.72   5.16   4.00   3.92   3.95
##  5 SW Suis…     1 acar…     0.5   5.14   3.73   5.73   5.16   4.03   3.94   3.96
##  6 SW Suis…     1 acar…     0.6   5.13   3.73   5.74   5.17   4.06   3.96   3.96
##  7 SW Suis…     1 acar…     0.7   5.12   3.74   5.75   5.17   4.08   3.97   3.96
##  8 SW Suis…     1 acar…     0.8   5.12   3.74   5.75   5.18   4.11   3.99   3.96
##  9 SW Suis…     1 acar…     0.9   5.11   3.75   5.76   5.18   4.14   4.01   3.96
## 10 SW Suis…     1 acar…     1     5.10   3.76   5.77   5.19   4.16   4.02   3.96
## # … with 88,094 more rows, and 993 more variables: draw_8 <dbl>, draw_9 <dbl>,
## #   draw_10 <dbl>, draw_11 <dbl>, draw_12 <dbl>, draw_13 <dbl>, draw_14 <dbl>,
## #   draw_15 <dbl>, draw_16 <dbl>, draw_17 <dbl>, draw_18 <dbl>, draw_19 <dbl>,
## #   draw_20 <dbl>, draw_21 <dbl>, draw_22 <dbl>, draw_23 <dbl>, draw_24 <dbl>,
## #   draw_25 <dbl>, draw_26 <dbl>, draw_27 <dbl>, draw_28 <dbl>, draw_29 <dbl>,
## #   draw_30 <dbl>, draw_31 <dbl>, draw_32 <dbl>, draw_33 <dbl>, draw_34 <dbl>,
## #   draw_35 <dbl>, draw_36 <dbl>, draw_37 <dbl>, draw_38 <dbl>, …

Plot salinity-biomass relationships

sal_conversions_sum<-apply(select(sal_conversions, starts_with("draw_")), 1, 
                           function(x) quantile(x, c(0.025, 0.5, 0.975)))

sal_conversions_plot<-sal_conversions%>%
  select(-starts_with("draw_"))%>%
  bind_cols(tibble(l95=sal_conversions_sum["2.5%",], 
                   median=sal_conversions_sum["50%",], 
                   u95=sal_conversions_sum["97.5%",]))
plot_sal_conversions<-function(group, data=sal_conversions_plot){
  
  if(group!="All"){
    data<-filter(data, IBMR%in%group)
    
  ggplot(data, aes(x=SalSurf, y=median, ymin=l95, ymax=u95))+
    geom_ribbon(alpha=0.4, fill="chartreuse4")+
    ylab("Zooplankton biomass (log scale)")+
    facet_grid(Region~month(Month, label=T))+
    theme_bw()+
    theme(axis.text.x=element_text(angle=45, hjust=1))
  }else{
  ggplot(data, aes(x=SalSurf, y=median, ymin=l95, ymax=u95, fill=IBMR))+
    geom_ribbon(alpha=0.4)+
    ylab("Zooplankton biomass (log scale)")+
    facet_grid(Region~month(Month, label=T))+
    scale_fill_viridis_d()+
    theme_bw()+
    theme(axis.text.x=element_text(angle=45, hjust=1))
  }
}
# Create plots for each IBMR group
sal_conversion_plots <- tibble(group=c("All", unique(model_factors$IBMR)))%>%
  mutate(plot=map(group, plot_sal_conversions))

Salinity-biomass plots

All

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

Apply model

Load in SMSCG modeled salinity

scenario_sal<-read_csv("Data/CSAMP_DS_SDM_salinity_scenarios.csv",
                       col_types = cols_only(region="c", year="i", month="i", 
                                             sal_base="d", sal_fallX2_hi="d", sal_fallX2_low="d", 
                                             sal_sumX2_hi="d", sal_sumX2_low ="d", sal_SMSCG="d"))%>%
  mutate(across(starts_with("sal_"), ~if_else(is.na(.x), sal_base, .x)))%>%
  filter(region%in%unique(zoop_data_mass$SUBREGION))%>%
  mutate(region=factor(region, 
                       levels=c("Confluence", "Suisun Marsh", "NE Suisun", 
                                "SE Suisun", "NW Suisun", "SW Suisun")))%>%
  pivot_longer(cols=starts_with("sal_"), names_to="Scenario", values_to="Salinity")%>% # Prepare data for easier plotting
  mutate(Scenario=factor(Scenario, 
                         levels=c("sal_SMSCG", "sal_sumX2_low", "sal_sumX2_hi",
                                  "sal_fallX2_low","sal_fallX2_hi", "sal_base")),
         Salinity=round(Salinity, 1))

Plot SMSCG modeled salinity

ggplot(scenario_sal, 
       aes(x=year, y=Salinity, color=Scenario))+
  geom_line()+
  scale_color_viridis_d(direction=-1)+
  facet_grid(region ~ month(month, label=T))+
  theme_bw()+
  theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))

Calculate zoop abundance difference between each scenario and the baseline

zoop_saladjusted<-scenario_sal%>%
  mutate(Salinity=as.character(Salinity),
         IBMR=unique(model_factors$IBMR)[1])%>%
  complete(region, year, month, Scenario, IBMR=unique(model_factors$IBMR))%>%
  group_by(region, year, month, Scenario)%>%
  mutate(Salinity=na.exclude(Salinity),
         region2=if_else(region%in%c("NE Suisun", "SE Suisun"), "East Suisun", as.character(region)))%>%
  ungroup()%>%
  left_join(sal_conversions%>%
              mutate(SalSurf=as.character(SalSurf)),
            by=c("region2"="Region",
                 "month"="Month",
                 "Salinity"="SalSurf",
                 "IBMR"="IBMR"))%>%
  select(-Salinity, -region2)%>%
  mutate(across(starts_with("draw_"), ~exp(.x)-1))%>%
  pivot_longer(starts_with("draw_"), names_prefix="draw_", names_to="draw", values_to="fit")%>%
  mutate(fit=if_else(fit<0, 0, fit))%>%
  pivot_wider(names_from="Scenario", values_from="fit")%>%
  mutate(across(starts_with("sal_"), ~.x/sal_base))%>%
  group_by(region, year, month, IBMR)%>%
  summarise(across(starts_with("sal_"), 
                   list(median=~median(.x, na.rm=T), 
                        l95=~quantile(.x, 0.025, na.rm=T), 
                        u95=~quantile(.x, 0.975, na.rm=T))), 
            .groups="drop")

write_csv(zoop_saladjusted, file.path("Outputs", "CSAMP zoop sal adjustments.csv"))

You can find the final zoop salinity adjustments here

Prepare plots

Plot the missing model results resulting from out-of-range salinity values in the inputs

missing_adjusted_data<-zoop_saladjusted%>%
         select(-ends_with("l95"), -ends_with("u95"))%>%
         filter(IBMR=="acartela")%>%
         pivot_longer(cols=starts_with("sal_"), names_to="Scenario", values_to="zoop_change")%>%
         mutate(Scenario=str_remove(Scenario, fixed("_median")))

ggplot(missing_adjusted_data,
       aes(x=year, y=Scenario, fill=is.na(zoop_change)))+
  geom_tile()+
  scale_fill_viridis_d(name="Are the model results missing due to out-of-range salinity values?")+
  facet_grid(region ~ month(month, label=T))+
  theme_bw()+
  theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))

Plot the result

Create some plotting functions

neglop1p<-trans_new("neglop1p", transform=function(x) sign(x)*log(abs(x)+1), inverse=function(x) sign(x)*(exp(abs(x))-1))
plot_scenario_result <- function(scenario, group) {
  
  plot_data<-zoop_saladjusted%>%
    filter(IBMR%in%group)
  
  ggplot(plot_data,
         aes(x=year, y=.data[[paste0(scenario, "_median")]], ymin=.data[[paste0(scenario, "_l95")]], ymax=.data[[paste0(scenario, "_u95")]]))+
    geom_ribbon(alpha=0.4, fill="darkorchid4")+
    geom_line(alpha=0.4, color="darkorchid4")+
    scale_y_continuous(trans=neglop1p, breaks=c(-1000, -100, -10, -1, 0, 1, 10, 100, 1000))+
    ylab("Scenario/baseline (log scale)")+
    facet_grid(region ~ month(month, label=T))+
    theme_bw()+
    theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))
}
# Create plots for each Parameter
scenario_result_plots <- expand_grid(Scenario=unique(scenario_sal$Scenario)[-1],
                                     IBMR=unique(model_factors$IBMR))%>%
  mutate(plot=map2(Scenario, IBMR, ~plot_scenario_result(.x, .y)))

Result plots

sal_fallX2_hi

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_hi

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_SMSCG

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other